<?php
	//ob_start('compress_page');
	require_once(CONTROLLER_DIR.'/template/header_page.phtml');
	require_once('search_seo.phtml');
?>
<script>
	function getContent(page)
	{
		var getURL = 'ajax/search.php?page='+page+'&keyword='+'<?php echo $keyword;?>';
		$.get(getURL, function(data) 
		{
			if(data.length > 10)
			{
				$('.pageitem-current').removeClass('pageitem-current');
				$('#products-accordion-content').hide('fast');
				$('#products-accordion-content').html(data);
				$('#products-accordion-content').show('fast');
				$('#page'+page).addClass('pageitem-current');
			}
			else {alert('Không có dữ liệu !');}
		});
	}
</script>
</head>	
<body>
	<div id="wrapper">
	<?php	require_once(CONTROLLER_DIR.'/template/header.phtml'); ?>	
		<div id="content" > 
			<div id="news-list" class="news-list" style='overflow-y:auto'>
<style type="text/css">
  .gsc-control-cse {
    font-family: Arial, sans-serif;
    border-color: #000000;
    background-color: #000000;
  }
  .gsc-control-cse .gsc-table-result {
    font-family: Arial, sans-serif;
  }
  input.gsc-input, .gsc-input-box, .gsc-input-box-hover, .gsc-input-box-focus {
    border-color: #D9D9D9;
  }
  input.gsc-search-button, input.gsc-search-button:hover, input.gsc-search-button:focus {
    border-color: #2F5BB7;
    background-color: #357AE8;
    background-image: none;
    filter: none;
	}
  .gsc-tabHeader.gsc-tabhInactive {
    border-color: #333333;
    background-color: #000000;
  }
  .gsc-tabHeader.gsc-tabhActive {
    border-color: #333333;
    border-bottom-color: #000000;
    background-color: #000000;
  }
  .gsc-tabsArea {
    border-color: #333333;
  }
  .gsc-webResult.gsc-result,
  .gsc-results .gsc-imageResult {
    border-color: #333333;
    background-color: #000000;
  }
  .gsc-webResult.gsc-result:hover,
  .gsc-imageResult:hover {
    border-color: #333333;
    background-color: #000000;
  }
  .gs-webResult.gs-result a.gs-title:link,
  .gs-webResult.gs-result a.gs-title:link b,
  .gs-imageResult a.gs-title:link,
  .gs-imageResult a.gs-title:link b {
    color: #5DB1E0;
  }
  .gs-webResult.gs-result a.gs-title:visited,
  .gs-webResult.gs-result a.gs-title:visited b,
  .gs-imageResult a.gs-title:visited,
  .gs-imageResult a.gs-title:visited b {
    color: #5DB1E0;
  }
  .gs-webResult.gs-result a.gs-title:hover,
  .gs-webResult.gs-result a.gs-title:hover b,
  .gs-imageResult a.gs-title:hover,
  .gs-imageResult a.gs-title:hover b {
    color: #5DB1E0;
  }
  .gs-webResult.gs-result a.gs-title:active,
  .gs-webResult.gs-result a.gs-title:active b,
  .gs-imageResult a.gs-title:active,
  .gs-imageResult a.gs-title:active b {
    color: #5DB1E0;
  }
  .gsc-cursor-page {
    color: #5DB1E0;
  }
  a.gsc-trailing-more-results:link {
    color: #5DB1E0;
  }
  .gs-webResult .gs-snippet,
  .gs-imageResult .gs-snippet,
  .gs-fileFormatType {
    color: #ffffff;
  }
  .gs-webResult div.gs-visibleUrl,
  .gs-imageResult div.gs-visibleUrl {
    color: #444444;
  }
  .gs-webResult div.gs-visibleUrl-short {
    color: #444444;
  }
  .gs-webResult div.gs-visibleUrl-short {
    display: none;
  }
  .gs-webResult div.gs-visibleUrl-long {
    display: block;
  }
  .gs-promotion div.gs-visibleUrl-short {
    display: none;
  }
  .gs-promotion div.gs-visibleUrl-long {
    display: block;
  }
  .gsc-cursor-box {
    border-color: #333333;
  }
  .gsc-results .gsc-cursor-box .gsc-cursor-page {
    border-color: #333333;
    background-color: #000000;
    color: #5DB1E0;
  }
  .gsc-results .gsc-cursor-box .gsc-cursor-current-page {
    border-color: #333333;
    background-color: #000000;
    color: #5DB1E0;
  }
  .gsc-webResult.gsc-result.gsc-promotion {
    border-color: #F6F6F6;
    background-color: #F6F6F6;
  }
  .gsc-completion-title {
    color: #5DB1E0;
  }
  .gsc-completion-snippet {
    color: #ffffff;
  }
  .gs-promotion a.gs-title:link,
  .gs-promotion a.gs-title:link *,
  .gs-promotion .gs-snippet a:link {
    color: #1155CC;
  }
  .gs-promotion a.gs-title:visited,
  .gs-promotion a.gs-title:visited *,
  .gs-promotion .gs-snippet a:visited {
    color: #1155CC;
  }
  .gs-promotion a.gs-title:hover,
  .gs-promotion a.gs-title:hover *,
  .gs-promotion .gs-snippet a:hover {
    color: #1155CC;
  }
  .gs-promotion a.gs-title:active,
  .gs-promotion a.gs-title:active *,
  .gs-promotion .gs-snippet a:active {
    color: #1155CC;
  }
  .gs-promotion .gs-snippet,
  .gs-promotion .gs-title .gs-promotion-title-right,
  .gs-promotion .gs-title .gs-promotion-title-right *  {
    color: #333333;
  }
  .gs-promotion .gs-visibleUrl,
  .gs-promotion .gs-visibleUrl-short {
    color: #009933;
  }</style>
  				<?php if(isset($_GET['cse'])){?>
				<div id="cse-search-results"></div>
					<script type="text/javascript">
					  var googleSearchIframeName = "cse-search-results";
					  var googleSearchFormName = "cse-search-box";
					  var googleSearchFrameWidth = "600";
					  var googleSearchDomain = "www.google.com";
					  var googleSearchPath = "/cse";
					</script>
					<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
					<script type="text/javascript">
					$('#cse-search-results').find('iframe').each(function(){
						$(this).attr('width', 650);
						//$(this).attr('height', 'auto');
						$(this).attr('height', 1130);
					});
				</script>
				<?php }?>
				<ul id="product-results" style="">
					<?php
					if($product_arr)
						echo "<li><h2 style='color:white;margin-bottom:0px'>KẾT QUẢ TÌM KIẾM</h2></li>";
						echo "<li class='righthr'></li>";
					?>
					<li>
						<ul id="products-accordion-content">
							<?php 
							if($product_arr)
							foreach($product_arr as $value)
							{
								$url = ProductUrl($value);
echo "						<li>\n";
echo "							<div class='productinfo'>\n";
echo "								<a title='{$value['product_name']}' href='$url'><img title='{$value['product_name']}' alt='{$value['product_name']}' width='56px' height='56px' src='{$value['product_img1']}' class='item'></a>\n";
echo "								<a title='{$value['product_name']}' href='$url'><strong class='itemname'>{$value['product_name']}</strong></a>\n";
	if($value['product_price_sale'] != 0)
		$price = FormatPrice($value['product_price_sale']);
	else
	{
		if($value['product_price'] != 0)
			$price = FormatPrice($value['product_price']);
		else
			$price = 'CALL';
	}
echo "	<div class='itemcost'>$price</div>\n<p>". strip_tags($value['product_des_short'])."</p>\n";
echo "								<span class='spacer'></span> \n";
echo "							</div>\n";
echo "						</li>\n";
echo "						<li class='righthr'></li>\n";
							}
							?>
						</ul>
					</li>
					
					<li>
						<div id="pages">
							<ul id="ecat-pagination-bottom" class="pagination">
								<?php
									for($i=1; $i<=$numPage;$i++)
									{
										if($i == 1)
											echo "<li class='pageitem'><a id='page$i' href=\"javascript: getContent($i)\" class='pageitem-current'>$i</a></li>\n";
										else
											echo "<li class='pageitem'><a id='page$i' href=\"javascript: getContent($i)\">$i</a></li>\n";
									}
								?>
							</ul>
						</div>
					</li>
					
					
				</ul>
				
			</div>
			
			
			<div id='content-right' style='float:left;'>
				<?php	
					require_once(CONTROLLER_DIR.'/template/wholesale/wholesale.php'); 
					require_once(CONTROLLER_DIR.'/template/ticker/ticker.php'); 
				?>	
				
			</div>
			<div class="spacer"></div>
		</div><!--id: content-->
	<?php require_once(CONTROLLER_DIR.'/template/poster/poster.php'); ?>	
	<?php require_once(CONTROLLER_DIR.'/template/footer.phtml'); ?>	
	</div><!--id: wrapper-->
</body>
</html>
<?php	
	/*  end the buffer, echo the page content  */
	//ob_end_flush();
?>	
